package com.sgcc.pda.greendao.entity;

import android.graphics.drawable.Drawable;
import android.os.Parcel;
import android.os.Parcelable;
import android.support.annotation.NonNull;

import com.google.gson.Gson;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.Transient;


/**
 * App信息实体类 ——对接网络实体.
 *
 * @author 王沛栋
 * @data 2018/1/25 15:30
 */
@Entity
public class AppBaseInfo implements Parcelable {

    /**
     * APP ID
     */
    @Property(nameInDb = "appId")
    private String appId;

    /**
     * APP包名
     */
    @Id
    @Property(nameInDb = "appPackage")
    private String appPackage;

    /**
     * APP分类ID
     */
    @Property(nameInDb = "verSortId")
    private String verSortId;

    /**
     *
     */
    @Property(nameInDb = "appUpdateState")
    private String appUpdateState;

    /**
     *
     */
    @Property(nameInDb = "createUserId")
    private String createUserId;

    /**
     * 发布时间
     */
    @Property(nameInDb = "pubTime")
    private String pubTime;

    /**
     *
     */
    @Property(nameInDb = "createUserName")
    private String createUserName;

    /**
     * 版本号
     */
    @Property(nameInDb = "verTypeName")
    private String verTypeName;

    /**
     *
     */
    @Property(nameInDb = "appPubStatus")
    private String appPubStatus;

    /**
     * 分类名称
     */
    @Property(nameInDb = "verSortName")
    private String verSortName;

    /**
     * APP图标
     */
    @Property(nameInDb = "appIcon")
    private String appIcon;

    /**
     *
     */
    @Property(nameInDb = "isNeedInstall")
    private String isNeedInstall;

    /**
     *
     */
    @Property(nameInDb = "appRemark")
    private String appRemark;

    /**
     *
     */
    @Property(nameInDb = "appScreenShot")
    private String appScreenShot;

    /**
     *
     */
    @Property(nameInDb = "appPubId")
    private String appPubId;

    /**
     *
     */
    @Property(nameInDb = "verUseState")
    private String verUseState;

    /**
     * APP名称
     */
    @Property(nameInDb = "appName")
    private String appName;

    /**
     *
     */
    @Property(nameInDb = "verTypeCode")
    private int verTypeCode;

    /**
     * APP开发者
     */
    @Property(nameInDb = "appUnitName")
    private String appUnitName;

    /**
     *
     */
    @Property(nameInDb = "pubRemark")
    private String pubRemark;

    /**
     * APP开发者ID
     */
    @Property(nameInDb = "appUnitId")
    private String appUnitId;

    /**
     *
     */
    @Property(nameInDb = "hardwareVer")
    private String hardwareVer;

    /**
     * APP文件路径
     */
    @Property(nameInDb = "appFilePath")
    private String appFilePath;

    /**
     *
     */
    @Property(nameInDb = "appRequestCode")
    private String appRequestCode;

    /**
     * 启动页activity
     */
    @Property(nameInDb = "appStartActivity")
    private String appStartActivity;

    /**
     *
     */
    @Property(nameInDb = "pubType")
    private String pubType;

    /**
     *
     */
    @Property(nameInDb = "appStartPackagename")
    private String appStartPackagename;

    /**
     * 分类图标
     */
    @Property(nameInDb = "verSortImg")
    private String verSortImg;

    /**
     * 定义应用的apk正在下载安装时的状态
     */
    @Property(nameInDb = "apkFileState")
    private int apkFileState;

    /**
     * apk文件大小
     */
    @Property(nameInDb = "apkFileSize")
    private String apkFileSize;

    /**
     * 增量更新状态
     */
    @Property(nameInDb = "addUpdate")
    private String addUpdate;

    /**
     * 版本号
     */
    @Property(nameInDb = "verCode")
    private String verCode;

    /**
     * 是否是增量更新
     */
    @Property(nameInDb = "updType")
    private String updType;

    /**
     * 桌面ID
     */
    @Property(nameInDb = "dId")
    private String dId;

    /**
     * 增量包文件下载地址
     */
    @Property(nameInDb = "appBugFilePath")
    private String appBugFilePath;

    /**
     * 增量包文件大小
     */
    @Property(nameInDb = "apkBugFileSize")
    private String apkBugFileSize;

    /**
     * APP文件MD5效验码
     */
    @Property(nameInDb = "appFileMD5")
    private String appFileMD5;

    /**
     * 增量包MD5
     */
    @Property(nameInDb = "appBugFileMD5")
    private String appBugFileMD5;
    /**
     * 是否具有APP权限
     */
    @Property(nameInDb = "isAuthor")
    private String isAuthor;
    /**
     * 应用安装方式
     * * 01 原生
     * * 02 插件
     * * 03 H5
     */
    @Property(nameInDb = "appInstallMethod")
    private String appInstallMethod;

    /**
     * 所属系统
     */
    @Property(nameInDb = "deskName")
    private String deskName;

    /**
     * 关联app信息，json数组样式
     */
    @Property(nameInDb = "relPageName")
    private String relPageName;
    /**
     * 关联app名称，以,分隔
     */
    @Property(nameInDb = "relName")
    private String relName;

    @Transient
    private String appAlias;

    @Transient
    private Drawable appIconLocDrawable;//包名解析的图片icon
    /**
     * 应用显示消息数目
     */
    @Transient
    private int appShowNum;
    /**
     * assets对应文件路径——适用于assets资源文件
     */
    @Transient
    private String assetsPath;
    @Transient
    private String installDataTime;//应用安装/卸载时间  用于显示
    @Transient
    private long installDataTimeLong;//应用安装/卸载时间  用于排序
    @Transient
    private int installType;//安装类型 0安装 1卸载
    /**
     * 应用安装状态
     * 0未安装  1已下载未安装  2已安装
     */
    @Transient
    private int isInstalled;
    @Transient
    private int systemInstallState;//系统应用安装状态  0 未安装 1有新的更新
    @Transient
    private String verName;

    @Generated(hash = 1681731421)
    public AppBaseInfo(String appId, String appPackage, String verSortId,
                       String appUpdateState, String createUserId, String pubTime,
                       String createUserName, String verTypeName, String appPubStatus,
                       String verSortName, String appIcon, String isNeedInstall,
                       String appRemark, String appScreenShot, String appPubId,
                       String verUseState, String appName, int verTypeCode, String appUnitName,
                       String pubRemark, String appUnitId, String hardwareVer,
                       String appFilePath, String appRequestCode, String appStartActivity,
                       String pubType, String appStartPackagename, String verSortImg,
                       int apkFileState, String apkFileSize, String addUpdate, String verCode,
                       String updType, String dId, String appBugFilePath,
                       String apkBugFileSize, String appFileMD5, String appBugFileMD5,
                       String isAuthor, String appInstallMethod, String deskName,
                       String relPageName, String relName) {
        this.appId = appId;
        this.appPackage = appPackage;
        this.verSortId = verSortId;
        this.appUpdateState = appUpdateState;
        this.createUserId = createUserId;
        this.pubTime = pubTime;
        this.createUserName = createUserName;
        this.verTypeName = verTypeName;
        this.appPubStatus = appPubStatus;
        this.verSortName = verSortName;
        this.appIcon = appIcon;
        this.isNeedInstall = isNeedInstall;
        this.appRemark = appRemark;
        this.appScreenShot = appScreenShot;
        this.appPubId = appPubId;
        this.verUseState = verUseState;
        this.appName = appName;
        this.verTypeCode = verTypeCode;
        this.appUnitName = appUnitName;
        this.pubRemark = pubRemark;
        this.appUnitId = appUnitId;
        this.hardwareVer = hardwareVer;
        this.appFilePath = appFilePath;
        this.appRequestCode = appRequestCode;
        this.appStartActivity = appStartActivity;
        this.pubType = pubType;
        this.appStartPackagename = appStartPackagename;
        this.verSortImg = verSortImg;
        this.apkFileState = apkFileState;
        this.apkFileSize = apkFileSize;
        this.addUpdate = addUpdate;
        this.verCode = verCode;
        this.updType = updType;
        this.dId = dId;
        this.appBugFilePath = appBugFilePath;
        this.apkBugFileSize = apkBugFileSize;
        this.appFileMD5 = appFileMD5;
        this.appBugFileMD5 = appBugFileMD5;
        this.isAuthor = isAuthor;
        this.appInstallMethod = appInstallMethod;
        this.deskName = deskName;
        this.relPageName = relPageName;
        this.relName = relName;
    }

    @Generated(hash = 487026447)
    public AppBaseInfo() {
    }

    /**
     * 数据库列名常量
     * (代码检测)
     */
    public static String VER_SORT_IMG = "verSortImg";
    public static String VER_SORT_ID = "verSortId";
    public static String VER_SORT_NAME = "verSortName";
    public static String APP_INSTALL_METHOD = "appInstallMethod";
    public static String APP_ICON = "appIcon";
    public static String APP_NAME = "appName";
    public static String APP_PACKAGE = "appPackage";
    public static String APP_FILE_PATH = "appFilePath";
    public static String APP_ID = "appId";
    public static String VER_TYPE_CODE = "verTypeCode";
    public static String VER_TYPE_NAME = "verTypeName";
    public static String APP_UNIT_ID = "appUnitId";
    public static String APP_UNIT_NAME = "appUnitName";
    public static String PUB_REMARK = "pubRemark";
    public static String HARDWARE_VER = "hardwareVer";
    public static String PUB_TYPE = "pubType";
    public static String PUB_TIME = "pubTime";
    public static String APK_FILE_SIZE = "apkFileSize";
    public static String APP_PUB_STATUS = "appPubStatus";
    public static String APP_BUG_FILE_PATH = "appBugFilePath";
    public static String APK_BUG_FILE_SIZE = "apkBugFileSize";
    public static String IS_AUTHOR = "isAuthor";
    public static String APP_UPDATE_STATE = "appUpdateState";
    public static String DESK_NAME = "deskName";
    public static String UPD_TYPE = "updType";
    public static String VER_CODE = "verCode";
    public static String ADD_UPDATE = "addUpdate";
    public static String RELPAGENAME = "relPageName";
    public static String APPFILEMD5 = "appFileMD5";
    public static String APPBUGFILEPATH = "appBugFilePath";
    public static String APPBUGFILEMD5 = "appBugFileMD5";
    public static String APP_START_ACTIVITY = "appStartActivity";

    public String getAppId() {
        return this.appId;
    }

    public void setAppId(String appId) {
        this.appId = appId;
    }

    public String getAppPackage() {
        return this.appPackage;
    }

    public void setAppPackage(String appPackage) {
        this.appPackage = appPackage;
    }

    public String getVerSortId() {
        return this.verSortId;
    }

    public void setVerSortId(String verSortId) {
        this.verSortId = verSortId;
    }

    public String getAppUpdateState() {
        return this.appUpdateState;
    }

    public void setAppUpdateState(String appUpdateState) {
        this.appUpdateState = appUpdateState;
    }

    public String getCreateUserId() {
        return this.createUserId;
    }

    public void setCreateUserId(String createUserId) {
        this.createUserId = createUserId;
    }

    public String getPubTime() {
        return this.pubTime;
    }

    public void setPubTime(String pubTime) {
        this.pubTime = pubTime;
    }

    public String getCreateUserName() {
        return this.createUserName;
    }

    public void setCreateUserName(String createUserName) {
        this.createUserName = createUserName;
    }

    public String getVerTypeName() {
        return this.verTypeName;
    }

    public void setVerTypeName(String verTypeName) {
        this.verTypeName = verTypeName;
    }

    public String getAppPubStatus() {
        return this.appPubStatus;
    }

    public void setAppPubStatus(String appPubStatus) {
        this.appPubStatus = appPubStatus;
    }

    public String getVerSortName() {
        return this.verSortName;
    }

    public void setVerSortName(String verSortName) {
        this.verSortName = verSortName;
    }

    public String getAppIcon() {
        return this.appIcon;
    }

    public void setAppIcon(String appIcon) {
        this.appIcon = appIcon;
    }

    public String getIsNeedInstall() {
        return this.isNeedInstall;
    }

    public void setIsNeedInstall(String isNeedInstall) {
        this.isNeedInstall = isNeedInstall;
    }

    public String getAppRemark() {
        return this.appRemark;
    }

    public void setAppRemark(String appRemark) {
        this.appRemark = appRemark;
    }

    public String getAppScreenShot() {
        return this.appScreenShot;
    }

    public void setAppScreenShot(String appScreenShot) {
        this.appScreenShot = appScreenShot;
    }

    public String getAppPubId() {
        return this.appPubId;
    }

    public void setAppPubId(String appPubId) {
        this.appPubId = appPubId;
    }

    public String getVerUseState() {
        return this.verUseState;
    }

    public void setVerUseState(String verUseState) {
        this.verUseState = verUseState;
    }

    public String getAppName() {
        return this.appName;
    }

    public void setAppName(String appName) {
        this.appName = appName;
    }

    public int getVerTypeCode() {
        return this.verTypeCode;
    }

    public void setVerTypeCode(int verTypeCode) {
        this.verTypeCode = verTypeCode;
    }

    public String getAppUnitName() {
        return this.appUnitName;
    }

    public void setAppUnitName(String appUnitName) {
        this.appUnitName = appUnitName;
    }

    public String getPubRemark() {
        return this.pubRemark;
    }

    public void setPubRemark(String pubRemark) {
        this.pubRemark = pubRemark;
    }

    public String getAppUnitId() {
        return this.appUnitId;
    }

    public void setAppUnitId(String appUnitId) {
        this.appUnitId = appUnitId;
    }

    public String getHardwareVer() {
        return this.hardwareVer;
    }

    public void setHardwareVer(String hardwareVer) {
        this.hardwareVer = hardwareVer;
    }

    public String getAppFilePath() {
        return this.appFilePath;
    }

    public void setAppFilePath(String appFilePath) {
        this.appFilePath = appFilePath;
    }

    public String getAppRequestCode() {
        return this.appRequestCode;
    }

    public void setAppRequestCode(String appRequestCode) {
        this.appRequestCode = appRequestCode;
    }

    public String getAppStartActivity() {
        return this.appStartActivity;
    }

    public void setAppStartActivity(String appStartActivity) {
        this.appStartActivity = appStartActivity;
    }

    public String getPubType() {
        return this.pubType;
    }

    public void setPubType(String pubType) {
        this.pubType = pubType;
    }

    public String getAppStartPackagename() {
        return this.appStartPackagename;
    }

    public void setAppStartPackagename(String appStartPackagename) {
        this.appStartPackagename = appStartPackagename;
    }

    public String getVerSortImg() {
        return this.verSortImg;
    }

    public void setVerSortImg(String verSortImg) {
        this.verSortImg = verSortImg;
    }

    public int getApkFileState() {
        return this.apkFileState;
    }

    public void setApkFileState(int apkFileState) {
        this.apkFileState = apkFileState;
    }

    public String getApkFileSize() {
        return this.apkFileSize;
    }

    public void setApkFileSize(String apkFileSize) {
        this.apkFileSize = apkFileSize;
    }

    public String getAddUpdate() {
        return this.addUpdate;
    }

    public void setAddUpdate(String addUpdate) {
        this.addUpdate = addUpdate;
    }

    public String getVerCode() {
        return this.verCode;
    }

    public void setVerCode(String verCode) {
        this.verCode = verCode;
    }

    public String getUpdType() {
        return this.updType;
    }

    public void setUpdType(String updType) {
        this.updType = updType;
    }

    public String getDId() {
        return this.dId;
    }

    public void setDId(String dId) {
        this.dId = dId;
    }

    public String getAppBugFilePath() {
        return this.appBugFilePath;
    }

    public void setAppBugFilePath(String appBugFilePath) {
        this.appBugFilePath = appBugFilePath;
    }

    public String getApkBugFileSize() {
        return this.apkBugFileSize;
    }

    public void setApkBugFileSize(String apkBugFileSize) {
        this.apkBugFileSize = apkBugFileSize;
    }

    public String getAppFileMD5() {
        return this.appFileMD5;
    }

    public void setAppFileMD5(String appFileMD5) {
        this.appFileMD5 = appFileMD5;
    }

    public String getAppBugFileMD5() {
        return this.appBugFileMD5;
    }

    public void setAppBugFileMD5(String appBugFileMD5) {
        this.appBugFileMD5 = appBugFileMD5;
    }

    public String getIsAuthor() {
        return this.isAuthor;
    }

    public void setIsAuthor(String isAuthor) {
        this.isAuthor = isAuthor;
    }

    public String getAppInstallMethod() {
        return this.appInstallMethod;
    }

    public void setAppInstallMethod(String appInstallMethod) {
        this.appInstallMethod = appInstallMethod;
    }

    public String getDeskName() {
        return this.deskName;
    }

    public void setDeskName(String deskName) {
        this.deskName = deskName;
    }

    public String getRelPageName() {
        return this.relPageName;
    }

    public void setRelPageName(String relPageName) {
        this.relPageName = relPageName;
    }

    public String getRelName() {
        return this.relName;
    }

    public void setRelName(String relName) {
        this.relName = relName;
    }



    public String getAppAlias() {
        return appAlias;
    }

    public void setAppAlias(String appAlias) {
        this.appAlias = appAlias;
    }

    public Drawable getAppIconLocDrawable() {
        return appIconLocDrawable;
    }

    public void setAppIconLocDrawable(Drawable appIconLocDrawable) {
        this.appIconLocDrawable = appIconLocDrawable;
    }

    public int getAppShowNum() {
        return appShowNum;
    }

    public void setAppShowNum(int appShowNum) {
        this.appShowNum = appShowNum;
    }

    public String getAssetsPath() {
        return assetsPath;
    }

    public void setAssetsPath(String assetsPath) {
        this.assetsPath = assetsPath;
    }

    public String getInstallDataTime() {
        return installDataTime;
    }

    public void setInstallDataTime(String installDataTime) {
        this.installDataTime = installDataTime;
    }

    public long getInstallDataTimeLong() {
        return installDataTimeLong;
    }

    public void setInstallDataTimeLong(long installDataTimeLong) {
        this.installDataTimeLong = installDataTimeLong;
    }

    public int getInstallType() {
        return installType;
    }

    public void setInstallType(int installType) {
        this.installType = installType;
    }

    public int getIsInstalled() {
        return isInstalled;
    }

    public void setIsInstalled(int isInstalled) {
        this.isInstalled = isInstalled;
    }


    public int getSystemInstallState() {
        return systemInstallState;
    }

    public void setSystemInstallState(int systemInstallState) {
        this.systemInstallState = systemInstallState;
    }

    public String getVerName() {
        return verName;
    }

    public void setVerName(String verName) {
        this.verName = verName;
    }

    @NonNull
    @Override
    public String toString() {
        return new Gson().toJson(this);
    }


    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeString(this.appId);
        dest.writeString(this.appPackage);
        dest.writeString(this.verSortId);
        dest.writeString(this.appUpdateState);
        dest.writeString(this.createUserId);
        dest.writeString(this.pubTime);
        dest.writeString(this.createUserName);
        dest.writeString(this.verTypeName);
        dest.writeString(this.appPubStatus);
        dest.writeString(this.verSortName);
        dest.writeString(this.appIcon);
        dest.writeString(this.isNeedInstall);
        dest.writeString(this.appRemark);
        dest.writeString(this.appScreenShot);
        dest.writeString(this.appPubId);
        dest.writeString(this.verUseState);
        dest.writeString(this.appName);
        dest.writeInt(this.verTypeCode);
        dest.writeString(this.appUnitName);
        dest.writeString(this.pubRemark);
        dest.writeString(this.appUnitId);
        dest.writeString(this.hardwareVer);
        dest.writeString(this.appFilePath);
        dest.writeString(this.appRequestCode);
        dest.writeString(this.appStartActivity);
        dest.writeString(this.pubType);
        dest.writeString(this.appStartPackagename);
        dest.writeString(this.verSortImg);
        dest.writeInt(this.apkFileState);
        dest.writeString(this.apkFileSize);
        dest.writeString(this.addUpdate);
        dest.writeString(this.verCode);
        dest.writeString(this.updType);
        dest.writeString(this.dId);
        dest.writeString(this.appBugFilePath);
        dest.writeString(this.apkBugFileSize);
        dest.writeString(this.appFileMD5);
        dest.writeString(this.appBugFileMD5);
        dest.writeString(this.isAuthor);
        dest.writeString(this.appInstallMethod);
        dest.writeString(this.deskName);
        dest.writeString(this.relPageName);
        dest.writeString(this.relName);
        dest.writeString(this.appAlias);
//        dest.writeParcelable(this.appIconLocDrawable, flags);
        dest.writeInt(this.appShowNum);
        dest.writeString(this.assetsPath);
        dest.writeString(this.installDataTime);
        dest.writeLong(this.installDataTimeLong);
        dest.writeInt(this.installType);
        dest.writeInt(this.isInstalled);
        dest.writeInt(this.systemInstallState);
        dest.writeString(this.verName);
    }

    protected AppBaseInfo(Parcel in) {
        this.appId = in.readString();
        this.appPackage = in.readString();
        this.verSortId = in.readString();
        this.appUpdateState = in.readString();
        this.createUserId = in.readString();
        this.pubTime = in.readString();
        this.createUserName = in.readString();
        this.verTypeName = in.readString();
        this.appPubStatus = in.readString();
        this.verSortName = in.readString();
        this.appIcon = in.readString();
        this.isNeedInstall = in.readString();
        this.appRemark = in.readString();
        this.appScreenShot = in.readString();
        this.appPubId = in.readString();
        this.verUseState = in.readString();
        this.appName = in.readString();
        this.verTypeCode = in.readInt();
        this.appUnitName = in.readString();
        this.pubRemark = in.readString();
        this.appUnitId = in.readString();
        this.hardwareVer = in.readString();
        this.appFilePath = in.readString();
        this.appRequestCode = in.readString();
        this.appStartActivity = in.readString();
        this.pubType = in.readString();
        this.appStartPackagename = in.readString();
        this.verSortImg = in.readString();
        this.apkFileState = in.readInt();
        this.apkFileSize = in.readString();
        this.addUpdate = in.readString();
        this.verCode = in.readString();
        this.updType = in.readString();
        this.dId = in.readString();
        this.appBugFilePath = in.readString();
        this.apkBugFileSize = in.readString();
        this.appFileMD5 = in.readString();
        this.appBugFileMD5 = in.readString();
        this.isAuthor = in.readString();
        this.appInstallMethod = in.readString();
        this.deskName = in.readString();
        this.relPageName = in.readString();
        this.relName = in.readString();
        this.appAlias = in.readString();
//        this.appIconLocDrawable = in.readParcelable(Drawable.class.getClassLoader());
        this.appShowNum = in.readInt();
        this.assetsPath = in.readString();
        this.installDataTime = in.readString();
        this.installDataTimeLong = in.readLong();
        this.installType = in.readInt();
        this.isInstalled = in.readInt();
        this.systemInstallState = in.readInt();
        this.verName = in.readString();
    }

    public static final Creator<AppBaseInfo> CREATOR = new Creator<AppBaseInfo>() {
        @Override
        public AppBaseInfo createFromParcel(Parcel source) {
            return new AppBaseInfo(source);
        }

        @Override
        public AppBaseInfo[] newArray(int size) {
            return new AppBaseInfo[size];
        }
    };
}
